<table class="admingrid" id="chamberlink">
</table>
<button onclick="addChamber()">Add chamber</button>
<button onclick="changeChamber()">Change chamber</button>
<button onclick="removeChamber()">Remove chamber</button>

<script>
grids.chamberlink = {
    url : generateServiceUrl({
        admin : true,
        service : "getlinkgroup",
        page : "static_content",
        params : {
            linkgroup : "chambers"
        }
    }),
    colNames : [
        "href",
        "title"
    ],
    colModel : [
        { name : "href",   index : "href",   width : 350 },
        { name : "title",  index : "title",  width : 350 }
    ],
    caption : "Chamber of commerce",
    multiselect : true,
    multiboxonly : true
};

function reorder_chamberlink(idlist) {
    callAdminService("static_content", "reorder", {
        idlist : idlist,
        groupname : "chambers"
    }, {
        success : function() { }
    });
}

function addChamber() {
    openAdminPopup("static_content", "addpopup", {
        title : "Adding new chamber"
    }, {
        groupname : "chambers"
    });
}

function changeChamber() {
    var id = getSelectedRow("chambers");
    openAdminPopup("static_content", "changepopup", {
        title : "Change chamber"
    }, {
        groupname : "chambers",
        id : id
    });
}

function removeChamber() {
    if (confirm("Are you sure to want to delete selected chambers?")) {
        var selectedItems = getSelectedRows("chamberlink");
        callAdminService("static_content", "deletelinkfromgroup", {
            ids : selectedItems,
            groupname : "chambers"
        }, {
            success : function(result) {
                refreshGrid("chamberlink");
            }
        });
    }
}

</script>
